var fs = require('fs')
var path = require('path')

module.exports = {
	entry:path.resolve(_dirname,'server.js'),

	output:{
		filename:'server.bundle.js'
	},

	target:'node',
	externals:fs.readdirSync(path.resolve(_dirname,'node_modules')).concate([
		'react-dom/server','react/addons',
		]).reduce(function (ext,mod){
			ext[mod] = 'commonjs' + mod
			return ext
		},{}),
		
		node:{
			_filename:true,
			_dirname:true
		},

		module:{
			loaders:[
               {test:/\.js$/,exclude:/node_modules/,loader:'babel-loader?presets[]=es2015&presets[]=react'}
			]
		}
}